<template>
    <div class='content'>

        <section>
            <div class="profile_page">
                    <head-top  :go-back='goBack'  :head-title="profiletitle"></head-top>
            </div>
            <div v-if="country.length>0">
                <div v-for="item in country" :key="item.subid">
                    <div v-if="item.awardGradation=='3664000001'||item.awardGradation=='3664000002'||item.awardGradation=='3664000003'" class="newsItem">
                        <div class="itemContent">
                            <div class="honerType">
                                <img src="@/assets/images/platform/geren.png" alt="">
                                <span>{{item.evaluateOrg}}</span>
                            </div>
                            <div class="itemLists">
                                <div class="itemList">
                                    <span class="itemName">荣誉名称:{{item.awardName}}</span>
                                    <span class="itemType">获取时间:{{item.awardTime}}</span>
                                </div>
                                <!-- <div class="itemList" v-for="item in country" :key="item.subid">
                                    <span class="itemName">{{item.awardName}}</span>
                                    <span class="itemType">{{item.a428202}}</span>
                                </div> -->
                            </div>
                        </div>
                    </div>
                    <div v-else-if="item.awardGradation=='3664000004'||item.awardGradation=='3664000005'||item.awardGradation=='3664000006'" class="newsItem">
                        <div class="itemContent">
                            <div class="honerType">
                                <img src="@/assets/images/platform/jituan.png" alt="">
                                <span>{{item.evaluateOrg}}</span>
                            </div>
                            <div class="itemLists">
                                <div class="itemList">
                                    <span class="itemName">荣誉名称:{{item.awardName}}</span>
                                    <span class="itemType">获取时间:{{item.awardTime}}</span>
                                </div>
                                <!-- <div class="itemList" v-for="item in group" :key="item.subid">
                                    <span class="itemName">{{item.a428200}}</span>
                                    <span class="itemType">{{item.a428202}}</span>
                                </div> -->
                            </div>
                        </div>
                    </div>
                    <div v-else class="newsItem">
                        <div class="itemContent">
                            <div class="honerType">
                                <img src="@/assets/images/platform/gongsi.png" alt="">
                                <span>{{item.evaluateOrg}}</span>
                            </div>
                            <div class="itemLists">
                                <div class="itemList">
                                    <span class="itemName">荣誉名称:{{item.awardName}}</span>
                                    <span class="itemType">获取时间:{{item.awardTime}}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <van-empty description="暂无荣誉"  v-if="country.length<=0"/>

        </section>
    </div>
</template>

<script>
    import headTop from '@/components/header/head';
    import {getHonorList} from '@/service/getData';
    import {getStore} from '@/assets/config/mUtils';
    import { Dialog,Toast } from 'vant';
    export default {
    	data(){
            return{
                profiletitle:'我的荣誉',
                goBack:true,
                CHECK_TIME: new Date().getTime().toString(),
                app_userId:'',
	            country:[],
	            group:[],
	            company:[],
	            countryTotal:0,
	            groupTotal:0,
	            companyTotal:0,
                loading: false,
                finished: false,
	            pageIndex:0,
                offset: 0,
            }
        },
        created(){
    	    this.app_userId = getStore('user_id');
    	    this.getBjHoner();
//     	    this.getJtHoner();
//     	    this.getGsHoner();
        },
        mounted(){


        },
        props: ['imgSrc', 'menuTitle'],
        components:{
            headTop,
        },
        filters:{
          dictNum:function(val){
  //          if(val != '' ||val != null){
            var dictarr = [
              { id: '3185000023', text: '开具各类人事证明' },
              { id: '3185000024', text: '户籍卡/户籍首页使用申请' },
              { id: '3185000025', text: '劳动合同使用申请' },
              { id: '3185000026', text: '因公/因私护照及通行证使用申请' },
              { id: '3185000027', text: '社会保险事项申请' },
              { id: '3185000028', text: '补充医疗、意外险报销申请' },
              { id: '3185000029', text: '公积金提取申请' },
              { id: '3185000030', text: '人事档案查询申请' },
              { id: '3185000031', text: '绩效申诉' }
            ];
              var arr = dictarr.filter(item=>item.id=== val);
            return arr[0].text;

  //          }
          }
        },
        methods:{
        	//获取国家荣誉
            getBjHoner(){
	            var data ={};
								// data.id = getStore('user_id');
	            data.app_userId = this.app_userId;
	            data.CHECK_TIME = this.CHECK_TIME;
	            data.CHECK_SIGN = this.$md5(this.app_userId + this.CHECK_TIME +"3a28fba00c015e0df7f88556c91cb7fc");
// 	            data.type = '3674000001';
// 	            data.pageIndex = this.pageIndex;
// 	            data.pageSize = 100;
	            getHonorList(data).then(res=>{
		            // 加载状态结束
		            console.log(res);
		            // this.countryTotal = res.data.total;
		            this.country = res.data.awardsCollection;
	            });
            },
	        getJtHoner(){
		        var data ={};
		        data.app_userId = this.app_userId;
		        data.CHECK_TIME = this.CHECK_TIME;
		        data.CHECK_SIGN = this.$md5(this.app_userId + this.CHECK_TIME +"3a28fba00c015e0df7f88556c91cb7fc");
		        data.type = '3674000002';
		        data.pageIndex = this.pageIndex;
		        data.pageSize = 100;
		        getHonorList(data).then(res=>{
			        // 加载状态结束
			        console.log(res);
			        this.groupTotal = res.data.total;
			        this.group = res.data.data;
		        });
	        },
	        getGsHoner(){
		        var data ={};
		        data.app_userId = this.app_userId;
		        data.CHECK_TIME = this.CHECK_TIME;
		        data.CHECK_SIGN = this.$md5(this.app_userId + this.CHECK_TIME +"3a28fba00c015e0df7f88556c91cb7fc");
		        data.type = '3674000003';
		        data.pageIndex = this.pageIndex;
		        data.pageSize = 100;
		        getHonorList(data).then(res=>{
			        // 加载状态结束
			        console.log(res);
			        this.companyTotal = res.data.total;
			        this.company = res.data.data;
		        });
	        },
        }
    }

</script>

<style lang="scss" scoped>
    @import '../../assets/style/mixin';
      @import '../../assets/style/public';
    .newsItem{
      padding-top: 0.5rem;
      .itemDate{
        display: flex;
        justify-content: center;
        font-size:0.6rem;
        color: #cccccc;
        height: 1.6rem;
        line-height:1.6rem;
      }
      .itemContent{
        margin: 0 0.5rem;
        background-color: #fff;
        padding: 0 0.4rem;
        border-top-left-radius: 0.2rem;
        border-top-right-radius: 0.2rem;
        position: relative;
        z-index: 99;
          .honerType{
              display: flex;
              flex-direction: row;
              align-items: center;
              padding-top: 0.2rem;
              img{
                  height: 1.5rem;
              }
              span{
                  margin-left: 0.5rem;
                  font-size: 0.6rem;
                  line-height: 1.5rem;
              }
          }
        .itemConHead{
          display: flex;
          align-items: center;
          font-size: 0.6rem;
          color: #333333;
          line-height: 0.8rem;
          padding:0.6rem 0;
          border-bottom: 1px solid #eee;
        }
        .itemLists{
          padding: 0.08rem;
          .itemList{
            display: flex;
            padding: 0.32rem 0;
            align-items: center;
            justify-content: flex-end;
            .itemName{
              color: #999999;
              font-size: 0.56rem;
              flex: 1;
              word-break: keep-all;
            }
            .itemType{
              margin-left: 0.4rem;
              color: #666666;
              font-size:0.56rem;
              // width:5rem;
              white-space: normal;
              word-break: break-all;
            }
          }
        }
      }
    }
</style>
